<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<div id="app">
    {{productList.reduce((total,pro)=>pro.price*pro.count+total ,0)}}
    {{totalPrice}}
</div>

<!--引入vue文件-->
<script type="text/javascript" src="js/vue-2.6.12.js"></script>
<script>
    const v=new Vue({
        el:"#app",
        data:{
            productList:[{name:"三国",price:100,count:2},{name:"三国2",price:50,count:3}]
        },
        computed:{//计算属性
            totalPrice:function(){
                return productList.reduce((total,pro)=>pro.price*pro.count+total ,0);
            }
        }
    });
    // let productList=[{name:"三国",price:100,count:2},{name:"三国2",price:50,count:3}];
    // var result=productList.reduce((total,pro)=>pro.price*pro.count+total ,0);
    // console.log(result);
</script>
</body>
</html>